// Some compilers support pragma once, some don't, use both 
// protections just to be safe.
#pragma once
#ifndef SUDOKUSOLVER_H
#define SUDOKUSOLVER_H

#include <vector>

class SudokuSolver
{
public:
	typedef int TileType;
	SudokuSolver(void);
	void setTileVal(int row, int col, TileType val);
	TileType getTileVal(int row, int col) const;
	void Solve(void);
private:
	class SudokuTile
	{
	private:
		int rowNum;
		int colNum;
		int boxNum;
		SudokuSolver::TileType possibleValues;
	public:
		SudokuTile();

		void setRowNum(int);
		int getRowNum() const {return rowNum;}

		void setColNum(int);
		int getColNum() const {return colNum;}

		void setBoxNum(int);
		int getBoxNum() const {return boxNum;}

		void setValue(SudokuSolver::TileType);
		SudokuSolver::TileType getValue() const;

      SudokuSolver::TileType copyValues(void) {return possibleValues;}
      bool comparePossible(const SudokuSolver::SudokuTile& in);
      int numPossible(void);
		bool removePossible(SudokuSolver::TileType);
		bool isPossible(SudokuSolver::TileType) const;
	};

	std::vector<SudokuTile> myGrid;

   SudokuSolver::SudokuTile& at(const int row, const int col);
   void dumpValues();
	void setTileRowColBox();
	bool processKnownValues();
   bool processNakedPairs();
   bool processTriangulations();
	bool findUniquePossibles();
};

#endif